openapi: 3.0.1
info:
  contact:
    email: info@berlin-group.org
    name: The Berlin Group - A European Standards Initiative
    url: https://www.berlin-group.org/
  description: |
    The processing of direct debit transactions comes with a related mandate of the debtor towards the creditor, creditor bank and debtor bank to process such mandates. 
    Such a mandate might come with a creditor mandate flow or a debtor mandate flow, depending on the underlying direct debit scheme. 
    The mandate can be signed by the debtor manually or the debtor agrees via electronic means, again depending on the related direct debit scheme rules. 
  license:
    name: Creative Commons Attribution 4.0 International Public License
    url: https://creativecommons.org/licenses/by/4.0/
  title: openFinance API Framework Implementation Guidelines Mandate Services
  version: "1.0"

externalDocs:
  description: |
    openFinance API Framework
    Implementation Guidelines for Extended Services
  url: https://www.berlin-group.org/openfinance-downloads

servers:
  - url: https://api.testbank.com/psd2
    description: PSD2 server
  - url: https://test-api.testbank.com/psd2
    description: Optional PSD2 test server

tags:
  - name: Mandates API
    description: |
      The implementation of such an API would of course require the related banks to clarify the compliance with the related direct debit scheme rules. The related direct debit scheme could e.g. 
        * define requirements on the API clients who are permitted to consume the APIs,
        * could mandate a digital signature of the authorisation proof by the debtor bank or
        * could restrict the usage of such a service to specific mandate classes. 

paths:
  /v2/mandates:
    post:
      summary: Establish Mandate Request on Dedicated Account
      description: | 
        Creates a mandate resource at the ASPSP for the account specified in this request.
        Note: This call is a Transaction Initiation Request in the sense of [oFA SMPF] and makes use e.g. of authorisation processes, where applicable, and header parameters as defined therein.
      operationId: createMandate
      tags:
        - Mandates API
      security:
        - {}
        - BearerAuthOAuth: []
      parameters:
        # - $ref: '#/components/parameters/HEADER_xRequestId'
        # - $ref: '#/components/parameters/HEADER_contentType_mandatory'
        # - $ref: '#/components/parameters/HEADER_psuIpAddress_mandatory'
          #common header parameter
        - $ref: "#/components/parameters/X-Request-ID"
          #header to support the signature function
        - $ref: "#/components/parameters/Digest"
        - $ref: "#/components/parameters/Signature"
        - $ref: "#/components/parameters/TPP-Signature-Certificate"
          #method specific header elements
          #BOI-REMARK: Mandatory
        - $ref: "#/components/parameters/PSU-ID"
        - $ref: "#/components/parameters/PSU-ID-Type"
        - $ref: "#/components/parameters/PSU-Corporate-ID"
        - $ref: "#/components/parameters/PSU-Corporate-ID-Type"
        # - $ref: "#/components/parameters/consentId_HEADER_optional"
        - $ref: "#/components/parameters/PSU-IP-Address_mandatory"
        #BOI-REMARK: Mandatory for ASPSP supporting Decoupled SCA approach
        - $ref: "#/components/parameters/TPP-Redirect-Preferred"
        - $ref: "#/components/parameters/TPP-Decoupled-Preferred"
          #BOI Remarks: changed to optional
        - $ref: "#/components/parameters/TPP-Redirect-URI"
        - $ref: "#/components/parameters/TPP-Nok-Redirect-URI"
        - $ref: "#/components/parameters/TPP-Explicit-Authorisation-Preferred"
        - $ref: "#/components/parameters/TPP-Rejection-NoFunds-Preferred"
        - $ref: "#/components/parameters/TPP-Brand-Logging-Information"
          #conditional for extended service lean Push
        - $ref: "#/components/parameters/TPP-Notification-URI"
        - $ref: "#/components/parameters/TPP-Notification-Content-Preferred"
          #optional additional PSU Information in header
        - $ref: "#/components/parameters/PSU-IP-Port"
        - $ref: "#/components/parameters/PSU-Accept"
        - $ref: "#/components/parameters/PSU-Accept-Charset"
        - $ref: "#/components/parameters/PSU-Accept-Encoding"
        - $ref: "#/components/parameters/PSU-Accept-Language"
        - $ref: "#/components/parameters/PSU-User-Agent"
        - $ref: "#/components/parameters/PSU-Http-Method"
        - $ref: "#/components/parameters/PSU-Device-ID"
        - $ref: "#/components/parameters/PSU-Geo-Location"
      requestBody:        
        required: true
        content: 
          application/json:
            schema:
              type: object
              required:
                - mandateId
                - type
                - creditor
                - debtor
                - debtorAccount
              properties:
                mandateId:
                  description: |
                    Unique identification, as assigned by the creditor, to unambiguously identify the mandate.
                  allOf:
                    - $ref: '#/components/schemas/Max35Text'
                type:
                  description: |
                    Specifies the type of mandate, such as paper, electronic or scheme.
                  allOf:
                    - $ref: '#/components/schemas/mandateType'
                occurrences:
                  description: |
                    Provides details of the duration of the mandate and occurrence of the underlying direct debit transactions.
                  allOf:
                    - $ref: '#/components/schemas/ocurrences'
                firstCollectionAmount:
                  description: |
                    Amount different from the collection amount, as it includes the costs associated with the first debited amount.
                  allOf:
                    - $ref: '#/components/schemas/amount'
                collectionAmount:
                  description: |
                    Fixed amount to be collected from the debtor's account
                  allOf:
                    - $ref: '#/components/schemas/amount'
                maximumAmount:
                  description: |
                    Maximum amount that may be collected from the debtor's account, per instruction.
                  allOf:
                    - $ref: '#/components/schemas/amount'
                reasonCode:
                  description: |
                    Provides the reason for the setup of the mandate as an ISO code.
                  allOf:
                    - $ref: '#/components/schemas/MandateSetupReasonCode'
                reasonProprietary:
                  description: |
                    Provides the reason for the setup of the mandate as a proprietary code.
                  allOf:
                    - $ref: '#/components/schemas/Max35Text'
                creditorSchemeIdentification:
                  description: |
                    Credit party that signs the mandate. Could be mandated by ASPSP to fulfil requirements of the related direct debit schemes.
                  allOf:
                    - $ref: '#/components/schemas/extendedPartyDescription'
                creditor:
                  description: |
                    Party that signs the mandate and to whom an amount of money is due.
                  allOf:
                    - $ref: '#/components/schemas/extendedPartyDescription'
                creditorAccount:
                  description: |
                    This attribute is optional by default, but maybe mandated by ASPSPs or Direct Debit Schemes. If so, this must be documented accordingly in e.g. related Discovery Services.
                  allOf:
                    - $ref: '#/components/schemas/accountReference'
                creditorAgent:
                  description: |
                  allOf:
                    - $ref: '#/components/schemas/agentDescription'
                ultimateCreditor:
                  description: |
                  allOf:
                    - $ref: '#/components/schemas/extendedPartyDescription'
                debtor:
                  description: |
                    In case of synchronous authorisation, this attribute might be made optional by rules of direct debit schemes or the implementing ASPSP in case the debtorAccount is provided. 
                  allOf:
                    - $ref: '#/components/schemas/extendedPartyDescription'
                debtorAccount:
                  description: |
                  allOf:
                    - $ref: '#/components/schemas/accountReference'
                ultimateDebtor:
                  description: |
                  allOf:
                    - $ref: '#/components/schemas/extendedPartyDescription'
                mandateReference:
                  description: |
                    Reference assigned by a creditor or ultimate creditor for internal usage for the mandate.
                  allOf:
                    - $ref: '#/components/schemas/Max35Text'
                referredDocument:
                  description: |
                    Provides information to identify the underlying documents associated with the mandate.
                  allOf:
                    - $ref: '#/components/schemas/referredMandateDocumentInformation'
      responses:
        '201':
          $ref: '#/components/responses/created_201_Mandates'
        '400':
          $ref: '#/components/responses/decline_400_Mandates'
        '401':
          $ref: '#/components/responses/decline_401_Mandates'
        '403':
          $ref: '#/components/responses/decline_403_Mandates'
        '404':
          $ref: '#/components/responses/decline_404_Mandates'
        '405':
          $ref: '#/components/responses/decline_405_Mandates'
        '406':
          $ref: '#/components/responses/decline_406_Mandates'
        '408':
          $ref: '#/components/responses/decline_408_Mandates'
        '409':
          $ref: '#/components/responses/decline_409_Mandates'
        '415':
          $ref: '#/components/responses/decline_415_Mandates'
        '500':
          $ref: '#/components/responses/decline_500'
        '503':
          $ref: '#/components/responses/decline_503'
  /v2/mandates/{resourceId}:
    get:
      summary: Get Mandate Request
      description: | 
        Returns the content of a mandate object. 
        This is returning the data for the API Client especially in cases, where the mandate was directly managed in detail between ASPSP and PSU e.g. in a re-direct SCA Approach.
      operationId: getMandate
      tags:
        - Mandates API
      security:
        - {}
        - BearerAuthOAuth: []
      parameters:
        - $ref: '#/components/parameters/PATH_resourceId'
      #header
          #common header parameter
        - $ref: "#/components/parameters/X-Request-ID"
          #header to support the signature function
        - $ref: "#/components/parameters/Digest"
        - $ref: "#/components/parameters/Signature"
        - $ref: "#/components/parameters/TPP-Signature-Certificate"
          #optional additional PSU Information in header
        - $ref: "#/components/parameters/PSU-IP-Address_optional"
        - $ref: "#/components/parameters/PSU-IP-Port"
        - $ref: "#/components/parameters/PSU-Accept"
        - $ref: "#/components/parameters/PSU-Accept-Charset"
        - $ref: "#/components/parameters/PSU-Accept-Encoding"
        - $ref: "#/components/parameters/PSU-Accept-Language"
        - $ref: "#/components/parameters/PSU-User-Agent"
        - $ref: "#/components/parameters/PSU-Http-Method"
        - $ref: "#/components/parameters/PSU-Device-ID"
        - $ref: "#/components/parameters/PSU-Geo-Location"
        # - $ref: '#/components/parameters/HEADER_digest'
        # - $ref: '#/components/parameters/HEADER_xJwsSignature'
        # - $ref: '#/components/parameters/HEADER_xRequestId'
      responses:
        '200':
          $ref: '#/components/responses/Ok_200_Mandates'
        '400':
          $ref: '#/components/responses/decline_400_Mandates'
        '401':
          $ref: '#/components/responses/decline_401_Mandates'
        '403':
          $ref: '#/components/responses/decline_403_Mandates'
        '404':
          $ref: '#/components/responses/decline_404_Mandates'
        '405':
          $ref: '#/components/responses/decline_405_Mandates'
        '406':
          $ref: '#/components/responses/decline_406'
        '408':
          $ref: '#/components/responses/decline_408'
        '409':
          $ref: '#/components/responses/decline_409_Mandates'
        '415':
          $ref: '#/components/responses/decline_415'
        '500':
          $ref: '#/components/responses/decline_500'
        '503':
          $ref: '#/components/responses/decline_503'
    delete:
      summary: Cancellation of a Mandate
      description: | 
        Deletes a given mandate
      operationId: deleteMandate
      tags:
        - Mandates API
      security:
        - {}
        - BearerAuthOAuth: []
      parameters:
        - $ref: '#/components/parameters/PATH_resourceId'
        # - $ref: '#/components/parameters/HEADER_digest'
        # - $ref: '#/components/parameters/HEADER_xJwsSignature'
        # - $ref: '#/components/parameters/HEADER_xRequestId'
        #header
        - $ref: "#/components/parameters/X-Request-ID"
          #header to support the signature function
        - $ref: "#/components/parameters/Digest"
        - $ref: "#/components/parameters/Signature"
        - $ref: "#/components/parameters/TPP-Signature-Certificate"
        - $ref: "#/components/parameters/TPP-Redirect-Preferred"
        - $ref: "#/components/parameters/TPP-Decoupled-Preferred"
        - $ref: "#/components/parameters/TPP-Nok-Redirect-URI"
        - $ref: "#/components/parameters/TPP-Redirect-URI"
        - $ref: "#/components/parameters/TPP-Explicit-Authorisation-Preferred"
          #optional additional PSU Information in header
        - $ref: "#/components/parameters/PSU-IP-Address_optional"
        - $ref: "#/components/parameters/PSU-IP-Port"
        - $ref: "#/components/parameters/PSU-Accept"
        - $ref: "#/components/parameters/PSU-Accept-Charset"
        - $ref: "#/components/parameters/PSU-Accept-Encoding"
        - $ref: "#/components/parameters/PSU-Accept-Language"
        - $ref: "#/components/parameters/PSU-User-Agent"
        - $ref: "#/components/parameters/PSU-Http-Method"
        - $ref: "#/components/parameters/PSU-Device-ID"
        - $ref: "#/components/parameters/PSU-Geo-Location"
      responses:
        '204':
          $ref: '#/components/responses/created_204_Mandates'
        '202':
          $ref: "#/components/responses/RECEIVED_202_MandatesCancel"
          #If the DELETE is not sufficient for cancelling the payment since an authorisation of the cancellation by the PSU is needed.
        '400':
          $ref: '#/components/responses/decline_400_Mandates'
        '401':
          $ref: '#/components/responses/decline_401_Mandates'
        '403':
          $ref: '#/components/responses/decline_403_Mandates'
        '404':
          $ref: '#/components/responses/decline_404_Mandates'
        '405':
          $ref: '#/components/responses/decline_405_Mandates'
        '406':
          $ref: '#/components/responses/decline_406'
        '408':
          $ref: '#/components/responses/decline_408'
        '409':
          $ref: '#/components/responses/decline_409_Mandates'
        '415':
          $ref: '#/components/responses/decline_415'
        '500':
          $ref: '#/components/responses/decline_500'
        '503':
          $ref: '#/components/responses/decline_503'
  /v2/mandates/{resourceId}/status:
    get:
      summary: Get Status Request
      description: | 
        Can check the status of a mandate resource.
      operationId: getMandateStatus
      tags:
        - Mandates API
      security:
        - {}
        - BearerAuthOAuth: []
      parameters:
        - $ref: '#/components/parameters/PATH_resourceId'
        # - $ref: '#/components/parameters/HEADER_xRequestId'
        #header
          #common header parameter
        - $ref: "#/components/parameters/X-Request-ID"
          #header to support the signature function
        - $ref: "#/components/parameters/Digest"
        - $ref: "#/components/parameters/Signature"
        - $ref: "#/components/parameters/TPP-Signature-Certificate"
          #optional additional PSU Information in header
        - $ref: "#/components/parameters/PSU-IP-Address_optional"
        - $ref: "#/components/parameters/PSU-IP-Port"
        - $ref: "#/components/parameters/PSU-Accept"
        - $ref: "#/components/parameters/PSU-Accept-Charset"
        - $ref: "#/components/parameters/PSU-Accept-Encoding"
        - $ref: "#/components/parameters/PSU-Accept-Language"
        - $ref: "#/components/parameters/PSU-User-Agent"
        - $ref: "#/components/parameters/PSU-Http-Method"
        - $ref: "#/components/parameters/PSU-Device-ID"
        - $ref: "#/components/parameters/PSU-Geo-Location"
      responses:
        '200':
          $ref: '#/components/responses/Ok_200_Mandates_Status'
        '400':
          $ref: '#/components/responses/decline_400_Mandates'
        '401':
          $ref: '#/components/responses/decline_401_Mandates'
        '403':
          $ref: '#/components/responses/decline_403_Mandates'
        '404':
          $ref: '#/components/responses/decline_404_Mandates'
        '405':
          $ref: '#/components/responses/decline_405_Mandates'
        '406':
          $ref: '#/components/responses/decline_406'
        '408':
          $ref: '#/components/responses/decline_408'
        '409':
          $ref: '#/components/responses/decline_409_Mandates'
        '415':
          $ref: '#/components/responses/decline_415'
        '500':
          $ref: '#/components/responses/decline_500'
        '503':
          $ref: '#/components/responses/decline_503'


components:
  securitySchemes:
    BearerAuthOAuth:
      description: |
        Bearer Token. 
        Is contained only, if an OAuth2 based authentication was performed in a pre-step or 
        an OAuth2 based SCA was performed in a preceding AIS service in the same session.
      type: http
      scheme: bearer
  schemas:
    ServiceLevelCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      enum:
        - BKTR
        - G001
        - G002
        - G003
        - G004
        - NPCA
        - NUGP
        - NURG
        - PRPT
        - SDVA
        - SEPA
        - SVDE
        - URGP
        - URNS
        - INST
        - SRTP
        - SVAT
        - G006
        - G007
        - G005
        - G009
        - WFSM
        - EOLO
      example: 'SEPA'
    Max2048Text:
      type: string
      maxLength: 2048
      example: 'Text, maximum of 2048 characters.'
    error_NG_409_Mandates: 
      type: object
      properties:
        apiClientMessages:
          type: array
          items:
            $ref: '#/components/schemas/clientMessageInformation_409_Mandates'
        _links:
          $ref: '#/components/schemas/links'
    _links_201_Mandates: 
      type: object
      additionalProperties: 
        $ref: '#/components/schemas/hrefType'
      properties:
        # scaRedirect:
        #   $ref: '#/components/schemas/hrefType'
        scaOAuth:
          $ref: '#/components/schemas/hrefType'
        confirmation:
          $ref: '#/components/schemas/hrefType'
        # startAuthorisation:
        #   $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithPsuIdentification:
        #   $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithPsuAuthentication:
        #   $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithEncryptedPsuAuthentication:
        #   $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithAuthenticationMethodSelection:
        #   $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithTransactionAuthorisation:
        #   $ref: '#/components/schemas/hrefType'
        self:
          $ref: '#/components/schemas/hrefType'
        status:
          $ref: '#/components/schemas/hrefType'
        scaStatus:
          $ref: '#/components/schemas/hrefType'
        # encryptionCertificates:
        #   type: array
        #   items: 
        #     $ref: '#/components/schemas/hrefType'
    error_NG_403_Mandates: 
      type: object
      properties:
        apiClientMessages:
          type: array
          items:
            $ref: '#/components/schemas/clientMessageInformation_403_Mandates'
        _links:
          $ref: '#/components/schemas/links'
    PreferredMethod:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Preferred Method\" for more details.
      type: string
      enum:
        - LETT
        - MAIL
        - PHON
        - FAXX
        - CELL
      example: 'MAIL'
    OrganisationIdentificationCode:
      description: |
      type: string
      enum:
        - BANK
        - CBID
        - CHID
        - CINC
        - COID
        - CUST
        - DUNS
        - EMPL
        - GS1G
        - SREN
        - SRET
        - TXID
        - BDID
        - BOID
      example: 'BOID'
    clientMessageInformation_400_Mandates:
      type: object
      required:
        - category
        - code
      properties:
        category:
          description: |
            Only \"ERROR\" or \"WARNING\" permitted
          type: string
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_400'
        path:
          type: string
        text:
          $ref: '#/components/schemas/Max500Text'
    clientMessageInformation_403_Mandates:
      type: object
      required:
        - category
        - code
      properties:
        category:
          description: |
            Only \"ERROR\" or \"WARNING\" permitted
          type: string
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_403'
        path:
          type: string
        text:
          $ref: '#/components/schemas/Max500Text'
    ocurrences:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Ocurrences\" for more details.
      type: object
      required:
        - sequenceType
      properties:
        sequenceType:
          description: |
            A code allocated to a business entity or to a financial institution by a Registration Authority under an international identification scheme.
          allOf:
            - $ref: '#/components/schemas/SequenceTypeCode'
        frequencyType:
          description: |
          allOf:
            - $ref: '#/components/schemas/FrequencyCode'
        duration:
          description: |
            Length of time for which the mandate remains valid.
          allOf:
            - $ref: '#/components/schemas/duration'
        firstCollectionDate:
          description: |
            Date of the first collection of a direct debit as per the mandate.
          allOf:
            - $ref: '#/components/schemas/ISODate'
        finalCollectionDate:
          description: |
            Date of the final collection of a direct debit as per the mandate.
          allOf:
            - $ref: '#/components/schemas/ISODate'
    Max500Text:
      type: string
      maxLength: 500
      example: 'Text, maximum of 500 characters.'
    
    mandatesCancelResponse-202:
      description: Body of the response for a successful cancel mandate request.
      type: object
      required:
        - mandateStatus
      properties:
        mandateStatus:
          $ref: "#/components/schemas/MandateStatus"
        # scaMethods:
        #   $ref: "#/components/schemas/scaMethods"
        # chosenScaMethod:
        #   $ref: "#/components/schemas/chosenScaMethod"
        # challengeData:
        #   $ref: "#/components/schemas/challengeData"
        _links:
          $ref: "#/components/schemas/_linksMandateCancellation"
    
    error_NG_400_Mandates: 
      type: object
      properties:
        apiClientMessages:
          type: array
          items:
            $ref: '#/components/schemas/clientMessageInformation_400_Mandates'
        _links:
          $ref: '#/components/schemas/links'
    CurrencyCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      pattern: '[A-Z]{3}'
      example: 'EUR'
    FrequencyCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Frequency Code\" for more details.
      type: string
      enum:
        - Daily
        - Weekly
        - EveryTwoWeeks
        - Monthly
        - EveryTwoMonths
        - Quarterly
        - SemiAnnual
        - Annual
        - MonthlyVariable
      example: 'Monthly'
    Max70Text:
      type: string
      maxLength: 70
      example: 'Text, maximum of 70 characters.'
    mandateType:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Mandate Type\" for more details.
      type: object
      properties:
        localInstrumentCode:
          description: |
            External List e.g. Core, B2B, DDMC (for electronic mandate)
          allOf:
            - $ref: '#/components/schemas/ExternalLocalInstrumentCode'
        localInstrumentProprietary:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        serviceLevelCode:
          description: |
            External code
          allOf:
            - $ref: '#/components/schemas/ServiceLevelCode'
        serviceLevelProprietary:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        categoryPurposeCode:
          description: |
            External list
          allOf:
            - $ref: '#/components/schemas/CategoryPurposeCode'
        categoryPurposeProprietary:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        classificationCode:
          description: |
            FIXE, USGB, VARI (internal code)
          allOf:
            - $ref: '#/components/schemas/ClassificationCode'
        classificationProprietary:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max35Text'
    referredMandateDocumentInformation:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Referred Mandate Document Information\" for more details.
      type: object
      properties:
        typeCode:
          description: |
            Specifies the type of referred document, provided as code.
          allOf:
            - $ref: '#/components/schemas/ReferredDocumentTypeCode'
        typeProprietary:
          description: |
            Specifies the type of referred document, provided in proprietary encoding.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        typeIssuer:
          description: |
            Issuer of the document type.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        number:
          description: |
            Unique and unambiguous identification of the referred document.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        creditorReference:
          description: |
            Unique and unambiguous identification as assigned by the creditor to the referred document shared with the debtor for its own reference.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        relatedDate:
          description: |
            Date associated with the referred document.
          allOf:
            - $ref: '#/components/schemas/ISODate'
    ClassificationCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Mandate Classification Code\" for more details.
      type: string
      enum:
        - FIXE
        - USGB
        - VARI
      example: 'FIXE'
    MandateSetupReasonCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Mandate Setup Reason Code\" for more details.
      type: string
    hrefType:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"href Type\" for more details.
      type: object
      required:
        - href
      properties:
        href:
          description: |
          type: string

    _linksMandateCancellation:
      description: |
        A list of hyperlinks to be recognised by the TPP. The actual hyperlinks used in the response depend on the
        dynamical decisions of the ASPSP when processing the request.

        Remark: All links can be relative or full links, to be decided by the ASPSP.

        Type of links admitted in this response, (further links might be added for ASPSP defined extensions):
          BOI Remarks: Added by BOI
          * 'scaOAuth':
            In case of a SCA OAuth2 Approach, the ASPSP is transmitting the URI where the
            configuration of the Authorisation Server can be retrieved.
            The configuration follows the OAuth 2.0 Authorisation Server Metadata specification.
      type: object
      additionalProperties:
        $ref: "#/components/schemas/hrefType"
      properties:
        scaOAuth:
          $ref: "#/components/schemas/hrefType"


    links:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Links\" for more details.
      type: object
      properties:
        # scaRedirect:
        #   description: |
        #     A link to an ASPSP site where SCA is performed within the Redirect SCA approach.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        scaOAuth:
          description: |
            The link refers to a JSON document specifying the OAuth details of the ASPSP's authorisation server. JSON document follows the definition given in [RFC 8414].
          allOf:
            - $ref: '#/components/schemas/hrefType'
        confirmation:
          description: |
            \"confirmation\": Might be added by the ASPSP if either the \"scaRedirect\" or \"scaOAuth\" hyperlink is returned in the same response message. 
            This hyperlink defines the URL to the resource which needs to be updated with 
            * a confirmation code as retrieved after the plain redirect authentication process with the ASPSP authentication server or
            * an access token as retrieved by submitting an authorization code after the integrated Oauth based authentication process with the ASPSP authentication server.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        # startAuthorisation:
        #   description: |
        #     A link to an endpoint, where the authorisation of a transaction or the authorisation of a transaction cancellation shall be started with a POST command. 
        #     No specific data is needed for this process start.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithPsuIdentification:
        #   description: |
        #     The link to an endpoint where the authorisation of a transaction or of a transaction cancellation shall be started, where PSU identification shall be uploaded 
        #     with the corresponding call.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # updatePsuIdentification:
        #   description: |
        #     The link to the payment initiation or account information resource, which needs to be updated by the PSU identification if not delivered yet.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithProprietaryData:
        #   description: |
        #     A link to the endpoint, where the authorisation of a transaction or of a transaction cancellation shall be started, and where proprietary data needs to be updated with this call. 
        #     The TPP can find the scope of missing proprietary data in the ASPSP documentation.
        #     The usage of this hyperlink is not further specified in the specification but is used analogously to e.g. the startAuthorisation withPsuIdentification hyperlink.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # updateProprietaryData:
        #   description: |
        #     The link to the payment initiation or account information resource, which needs to be updated by the proprietary data.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithPsuAuthentication:
        #   description: |
        #     The link to an endpoint where the authorisation of a transaction or of a transaction cancellation shall be started, where PSU authentication data shall be uploaded 
        #     with the corresponding call.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # updatePsuAuthentication:
        #   description: |
        #     The link to the payment initiation or account information resource, which needs to be updated by a PSU password and eventually the PSU identification if not delivered yet. 
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithEncryptedPsuAuthentication:
        #   description: |
        #     The link to an endpoint where the authorisation of a transaction or of a transaction cancellation shall be started, where encrypted PSU authentication data shall be uploaded 
        #     with the corresponding call.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # updateEncryptedPsuAuthentication:
        #   description: |
        #     The link to the payment initiation or account information resource, which needs to be updated by an encrypted PSU password and eventually the PSU identification if not delivered yet. 
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithAuthenticationMethodSelection:
        #   description: |
        #     This is a link to and endpoint where the authorisation of a transaction or of a transaction cancellation shall be started, 
        #     where the selected SCA method shall be uploaded  with the corresponding call.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # selectAuthenticationMethod:
        #   description: |
        #     This is a link to a resource, where the TPP can select the applicable second factor authentication methods for the PSU, if there were several available authentication methods. 
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # startAuthorisationWithTransactionAuthorisation:
        #   description: |
        #     A link to an endpoint, where an authorisation of a transaction or a cancellation can be started, and where the response data for the challenge is uploaded in the same call for the 
        #     transaction authorisation or transaction cancellation at the same time in the Embedded SCA Approach.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # authoriseTransaction:
        #   description: |
        #     The link to the payment initiation or consent resource, where the \"Transaction Authorisation\"Request\" is sent to. This is the link to the resource which will authorise the payment or the consent by 
        #     checking the SCA authentication data within the Embedded SCA approach.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        # updateResourceByDebtorAccountResource:
        #   description: |
        #     A link to a payment related resource which needs to be updated by an account, referenced by a resource identification.
        #   allOf:
        #     - $ref: '#/components/schemas/hrefType'
        self:
          description: |
            The link to the payment initiation resource created by the request itself. 
            This link can be used later to retrieve the transaction status of the payment initiation.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        status:
          description: |
            A link to retrieve the status of the transaction resource.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        transactionfees:
          description: |
            The link is to the status resource.  
            This link is only added within the authorisation process in case fee information is available via the status resource.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        scaStatus:
          description: |
            A link to retrieve the status of the authorisation or cancellation-authorisation sub-resource.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        account:
          description: |
            A link to the resource providing the details of one account
          allOf:
            - $ref: '#/components/schemas/hrefType'
        savingsAccount:
          description: |
            A link to the resource providing the details of a savings account.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        loanAccount:
          description: |
            A link to the resource providing the details of a loan account.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        balances:
          description: |
            A link to the resource providing the balance of a dedicated account.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        transactions:
          description: |
            A link to the resource providing the transaction history of a dedicated account.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        cardAccount:
          description: |
            A link to the resource providing the details of one card account.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        cardTransactions:
          description: |
            A link to the resource providing the transaction history of a dedicated card account.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        transactionDetails:
          description: |
            A link to the resource providing details of a dedicated transaction.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        ibanCheck:
          description: |
            A link to the endpoint offering the addressed iban check result.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        paymentInitiation:
          description: |
            A link to an initiation related to a payment resource.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        securitiesAccount:
          description: |
            A link to the resource providing the details of one securitiesAccount.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        positions:
          description: |
            A link to the resource providing the list of positions of one securitiesAccount.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        orders:
          description: |
            A link to the resource providing the list of orders of one securitiesAccount.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        orderDetails:
          description: |
            A link to the resource providing details of one specific order.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        relatedOrders:
          description: |
            An array of links to request order details of related orders related to the order that is represented by the data structure containing this element 
            (e.g. other orders that originated from the same order split as this order). 
          type: array
          items:
            $ref: '#/components/schemas/hrefType'
        relatedTransactions:
          description: |
            An array of links to request securities transaction details of transactions that resulted from this order.
          type: array
          items:
            $ref: '#/components/schemas/hrefType'
        subscription:
          description: |
            A link to the resource providing the details of a subscription for Push AIS Services.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        entryStatusRevoked:
          description: |
            Links to entry endpoints where the entry status is revoked.
          type: array
          items:
            $ref: '#/components/schemas/hrefType'
        first:
          description: |
            Navigation link for paginated account reports.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        next:
          description: |
            Navigation link for paginated account reports.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        previous:
          description: |
            Navigation link for paginated account reports.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        last:
          description: |
            Navigation link for paginated account reports.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        download:
          description: |
            Download link for huge AIS data packages.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        confirmInitiation:
          description: |
            link to a confirmation endpoint, where a payment initiation needs to be confirmed explicitly by the API Client for execution.
          allOf:
            - $ref: '#/components/schemas/hrefType'
        aspspParameters:
          description: |
          allOf:
            - $ref: '#/components/schemas/hrefType'
        aspspContacts:
          description: |
          allOf:
            - $ref: '#/components/schemas/hrefType'
        aspspDowntimes:
          description: |
          allOf:
            - $ref: '#/components/schemas/hrefType'
    UUID:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      format: uuid
      example: '99435c7e-ad88-49ec-a2ad-99ddcb1f5555'
    genericFinancialInstitutionIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Generic Financial Institution Identification\" for more details.
      type: object
      required:
        - identification
      properties:
        identification:
          description: |
            Unique and unambiguous identification of a financial insitution.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        schemeNameCode:
          description: |
            An entry provided by an external ISO code list
          allOf:
            - $ref: '#/components/schemas/FinancialInstitutionIdentificationCode'
        schemeNameProprietary:
          description: |
            A scheme name defined in a proprietary way.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        issuer:
          description: |
            Issuer of the identification
          allOf:
            - $ref: '#/components/schemas/Max35Text'
    financialInstitutionIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Financial Institution Identification\" for more details.
      type: object
      properties:
        bicfi:
          description: |
          allOf:
            - $ref: '#/components/schemas/BICFI'
        clearingSystemMemberId:
          description: |
            Information used to identify a member within a clearing system.
          allOf:
            - $ref: '#/components/schemas/clearingSystemMemberIdentification'
        name:
          description: |
            Name of the financial institution
          allOf:
            - $ref: '#/components/schemas/Max140Text'
        postalAddress:
          description: |
            Postal Address of the financial institution.
          allOf:
            - $ref: '#/components/schemas/postalAddress'
        other:
          description: |
            Unique identification of an organisation, as assigned by an institution, using an identification scheme.
          allOf:
            - $ref: '#/components/schemas/genericFinancialInstitutionIdentification'
    AuthenticationType:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Authentication Type\" for more details.
      type: string
      enum: 
        - SMS_OTP
        - CHIP_OTP
        - PHOTO_OTP
        - PUSH_OTP
        - SMTP_OTP
      example: 'PUSH_OTP'
    Max35Text:
      type: string
      maxLength: 35
      example: 'Text, maximum of 35 characters.'
    SequenceTypeCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      enum:
      #  - FRST
        - RCUR
      #  - FNAL
        - OOFF
      #  - RPRE
      example: 'OOFF'
    
    msisdn:
          description: |
            An alias to access a payment account via a registered mobile phone number.
          type: string
          pattern: ^[0-9]{3}-\+?[1-9]\d{1,14}(\s?\d{1,13})*$

    accountReference:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Account Reference\" for more details.
      type: object
      properties:
        iban:
          description: |
          allOf:
            - $ref: '#/components/schemas/IBAN'
        bban:
          description: |
            BBAN of the account. This data elements is used for payment accounts which have no IBAN.
          allOf:
            - $ref: '#/components/schemas/BBAN'
        # pan:
        #   description: |
        #     Primary Account Number (PAN) of a card, can be tokenised by the ASPSP due to PCI DSS requirements. 
        #   allOf:
        #     - $ref: '#/components/schemas/Max35Text'
        maskedPan:
          description: |
            Primary Account Number (PAN) of a card in a masked form.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        msisdn:
          description: |
            An alias to access a payment account via a registered mobile phone number.
          allOf:
            - $ref: '#/components/schemas/msisdn'
        other:
          description: |
            An alias with a proprietary coding
          allOf:
            - $ref: '#/components/schemas/genericAccountIdentification'
        typeCode:
          description: |
            Remark: Shall not be used in the consent model, since account category provides enough information for the ASPSP.
          allOf:
            - $ref: '#/components/schemas/CashAccountType'
        typeProprietary:
          description: |
            Remark: Shall not be used in the consent model, since account category provides enough information for the ASPSP.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        currency:
          description: |
            ISO 4217 Alpha 3 currency code
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        # proxy:
        #   description: |
        #   allOf:
        #     - $ref: '#/components/schemas/proxyAccountIdentification'
    IBAN:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      pattern: '[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}'
      example: 'FR7612345987650123456789014'
    ClearingSystemIdentificationCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more detail
      type: string
      enum:
        - ATBLZ
        - AUBSB
        - CACPA
        - CHBCC
        - CHSIC
        - CNAPS
        - DEBLZ
        - ESNCC
        - GBDSC
        - GRBIC
        - HKNCC
        - IENCC
        - INFSC
        - ITNCC
        - JPZGN
        - NZNCC
        - PLKNR
        - PTNCC
        - RUCBC
        - SESBA
        - SGIBG
        - THCBC
        - TWNCC
        - USABA
        - USPID
        - ZANCC
        - NZRSA
        - MZBMO
        - CNCIP
        - KRBOK
      example: 'DEBLZ'
    Max16Text:
      type: string
      maxLength: 16
      example: '16 Chars at most'
    error_RFC7807_405_Mandates: 
      description: |
        Standardised definition of reporting error information according to [RFC7807].
      type: object
      required:
        - type
        - code
      properties:
        type: 
          description: |
            A URI reference [RFC3986] that identifies the problem type. 
            Remark For Future: These URI will be provided by NextGenPSD2 in future.
          type: string
          format: uri
          maxLength: 70
        title:
          description: |
            Short human readable description of error type. Could be in local language. To be provided by ASPSPs.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        status:
          description: |
            HTTP response code generated by the server.
            If contained, this is more relevant as the actual http response code in the actual response, because it is introduced by the application server.            
          type: integer
        detail:
          description: |
            Detailed human readable text specific to this instance of the error. 
          allOf:
            - $ref: '#/components/schemas/Max500Text'
        instance:
          description: |
            This attribute is containing a JSON pointer (as defined in [RFC6901]) or XPath expression to indicate the path to an issue generating the error in the related request.
          allOf:
            - $ref: '#/components/schemas/Max256Text'
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_405'
        additionalErrors:
          description: |
            Array of Error Information Blocks.
            Might be used if more than one error is to be communicated
          type: array
          items: #ErrorInformation
            description: This is a data element to support the declaration of additional errors in the context of [RFC7807]. 
            type: object
            required:
              - code
            properties:
              title:
                $ref: '#/components/schemas/Max70Text'
              detail:
                $ref: '#/components/schemas/Max500Text'
              code:
                $ref: '#/components/schemas/MessageCode_ServiceUnspecific_405'
        _links:
          $ref: '#/components/schemas/links'
    error_NG_404_Mandates: 
      type: object
      properties:
        apiClientMessages:
          type: array
          items:
            $ref: '#/components/schemas/clientMessageInformation_404_Mandates'
        _links:
          $ref: '#/components/schemas/links'
    clientMessageInformation_404_Mandates:
      type: object
      required:
        - category
        - code
      properties:
        category:
          description: |
            Only \"ERROR\" or \"WARNING\" permitted
          type: string
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_404'
        path:
          type: string
        text:
          $ref: '#/components/schemas/Max500Text'
    CashAccountType:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      enum:
        - CACC
        # - CARD
        # - SCTS
        # - LOAN
        # - SVGS
        # - CASH
        # - CHAR
        # - CISH
        # - COMM
        # - CPAC
        # - LLSV
        # - MGLD
        # - MOMA
        # - NREX
        # - ODFT
        # - ONDP
        # - OTHR
        # - SACC
        # - SLRY
        # - TAXE
        # - TRAN
        # - TRAS
        # - VACC
        # - NFCA
      example: 'CACC'
    genericAccountIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Generic Account Identification\" for more details.
      type: object
      required:
        - identification
      properties:
        identification:
          description: |
            Unique and unambiguous identification of an account.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        schemeNameCode:
          description: |
            An entry provided by an external ISO code list
          allOf:
            - $ref: '#/components/schemas/AccountIdentificationCode'
        schemeNameProprietary:
          description: |
            A scheme name defined in a proprietary way.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        issuer:
          description: |
            Issuer of the identification
          allOf:
            - $ref: '#/components/schemas/Max35Text'
    postalAddress:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Postal Address\" for more details.
      type: object
      properties:
        addressLines:
          description: |
            At most seven entries are permitted. May only be used, if none of the structured address elements \"streetName\", \"buildingNumber\", \"postcode\" or \"townName\" is used.
            *Remark:* For SEPA transactions this is further restricted to a maximum of 1 entry.
          type: array
          maxItems: 7
          items:
            $ref: '#/components/schemas/Max140Text'
        department:
          description: |
            Identification of a division of a large organisation or building.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        subDepartment:
          description: |
            Identification of a sub-division of a large organisation or building.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        streetName:
          description: |
            Name of a street or thoroughfare.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        buildingNumber:
          description: |
            Number that identifies the position of a building on a street.
          allOf:
            - $ref: '#/components/schemas/Max16Text'
        buildingName:
          description: |
            Name of the building or house.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        floor:
          description: |
            Floor or storey within a building.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        postBox:
          description: |
            Numbered box in a post office, assigned to a person or organisation, where letters are kept until called for.
          allOf:
            - $ref: '#/components/schemas/Max16Text'
        room:
          description: |
            Building room number.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        postCode:
          description: |
            Identifier consisting of a group of letters and/or numbers that is added to a postal address to assist the sorting of mail.
          allOf:
            - $ref: '#/components/schemas/Max16Text'
        townName:
          description: |
            Name of a built-up area, with defined boundaries, and a local government. 
            *Usage Rule:* If address lines are not used, this attribute is mandatrory.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        townLocationName:
          description: |
            Specific location name within the town.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        districtName:
          description: |
            Identifies a subdivision within a country sub-division.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        countrySubDivision:
          description: |
            Identifies a subdivision of a country such as state, region, county.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        country:
          description: |
            Nation with its own government.
            *Usage Rule:* If address lines are not used, this attribute is mandatrory.
          allOf:
            - $ref: '#/components/schemas/CountryCode'
    genericOrganisationIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Generic Organisation Identification\" for more details.
      type: object
      required:
        - identification
      properties:
        identification:
          description: |
            Unique and unambiguous identification of an organisation.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        schemeNameCode:
          description: |
            An entry provided by an external ISO code list
          allOf:
            - $ref: '#/components/schemas/OrganisationIdentificationCode'
        schemeNameProprietary:
          description: |
            A scheme name defined in a proprietary way.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        issuer:
          description: |
            Issuer of the identification
          allOf:
            - $ref: '#/components/schemas/Max35Text'
    psuId:
      description: |
        Psu Id number or passport number.
      type: string
      pattern: "^([0-9]{9}|[A-Za-z]{2}-([A-Za-z0-9]){1,16})$"


    personIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Person Identification\" for more details.
      type: object
      required:
        - identification
      properties:
        identification:
          description: |
            Unique and unambiguous identification of a oersib.
          allOf:
            #- $ref: '#/components/schemas/Max35Text'
            - $ref: '#/components/schemas/psuId'
        schemeNameCode:
          description: |
            An entry provided by an external ISO code list
          allOf:
            - $ref: '#/components/schemas/PersonIdentificationCode'
        schemeNameProprietary:
          description: |
            A scheme name defined in a proprietary way.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        issuer:
          description: |
            Issuer of the identification
          allOf:
            - $ref: '#/components/schemas/Max35Text'
    privateIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Private Identification\" for more details.
      type: object
      properties:
        birthDate:
          description: |
          allOf:
            - $ref: '#/components/schemas/ISODate'
        provinceOfBirth:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        cityOfBirth:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        countryOfBirth:
          description: |
          allOf:
            - $ref: '#/components/schemas/CountryCode'
        others:
          description: |
            Unique identification of a person, as assigned by an institution, using an identification scheme. 
            Shall be used if none of the above attributes is used.
          type: array
          items:
            $ref: '#/components/schemas/personIdentification'
    error_RFC7807_400_Mandates: 
      description: |
        Standardised definition of reporting error information according to [RFC7807].
      type: object
      required:
        - type
        - code
      properties:
        type: 
          description: |
            A URI reference [RFC3986] that identifies the problem type. 
            Remark For Future: These URI will be provided by NextGenPSD2 in future.
          type: string
          format: uri
          maxLength: 70
        title:
          description: |
            Short human readable description of error type. Could be in local language. To be provided by ASPSPs.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        status:
          description: |
            HTTP response code generated by the server.
            If contained, this is more relevant as the actual http response code in the actual response, because it is introduced by the application server.            
          type: integer
        detail:
          description: |
            Detailed human readable text specific to this instance of the error. 
          allOf:
            - $ref: '#/components/schemas/Max500Text'
        instance:
          description: |
            This attribute is containing a JSON pointer (as defined in [RFC6901]) or XPath expression to indicate the path to an issue generating the error in the related request.
          allOf:
            - $ref: '#/components/schemas/Max256Text'
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_400'
        additionalErrors:
          description: |
            Array of Error Information Blocks.
            Might be used if more than one error is to be communicated
          type: array
          items: #ErrorInformation
            description: This is a data element to support the declaration of additional errors in the context of [RFC7807]. 
            type: object
            required:
              - code
            properties:
              title:
                $ref: '#/components/schemas/Max70Text'
              detail:
                $ref: '#/components/schemas/Max500Text'
              code:
                $ref: '#/components/schemas/MessageCode_ServiceUnspecific_400'
        _links:
          $ref: '#/components/schemas/links'
    clientMessageInformation_409_Mandates:
      type: object
      required:
        - category
        - code
      properties:
        category:
          description: |
            Only \"ERROR\" or \"WARNING\" permitted
          type: string
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_409'
        path:
          type: string
        text:
          $ref: '#/components/schemas/Max500Text'
    error_RFC7807_401_Mandates: 
      description: |
        Standardised definition of reporting error information according to [RFC7807].
      type: object
      required:
        - type
        - code
      properties:
        type: 
          description: |
            A URI reference [RFC3986] that identifies the problem type. 
            Remark For Future: These URI will be provided by NextGenPSD2 in future.
          type: string
          format: uri
          maxLength: 70
        title:
          description: |
            Short human readable description of error type. Could be in local language. To be provided by ASPSPs.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        status:
          description: |
            HTTP response code generated by the server.
            If contained, this is more relevant as the actual http response code in the actual response, because it is introduced by the application server.            
          type: integer
        detail:
          description: |
            Detailed human readable text specific to this instance of the error. 
          allOf:
            - $ref: '#/components/schemas/Max500Text'
        instance:
          description: |
            This attribute is containing a JSON pointer (as defined in [RFC6901]) or XPath expression to indicate the path to an issue generating the error in the related request.
          allOf:
            - $ref: '#/components/schemas/Max256Text'
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_401'
        additionalErrors:
          description: |
            Array of Error Information Blocks.
            Might be used if more than one error is to be communicated
          type: array
          items: #ErrorInformation
            description: This is a data element to support the declaration of additional errors in the context of [RFC7807]. 
            type: object
            required:
              - code
            properties:
              title:
                $ref: '#/components/schemas/Max70Text'
              detail:
                $ref: '#/components/schemas/Max500Text'
              code:
                $ref: '#/components/schemas/MessageCode_ServiceUnspecific_401'
        _links:
          $ref: '#/components/schemas/links'
    error_RFC7807_404_Mandates: 
      description: |
        Standardised definition of reporting error information according to [RFC7807].
      type: object
      required:
        - type
        - code
      properties:
        type: 
          description: |
            A URI reference [RFC3986] that identifies the problem type. 
            Remark For Future: These URI will be provided by NextGenPSD2 in future.
          type: string
          format: uri
          maxLength: 70
        title:
          description: |
            Short human readable description of error type. Could be in local language. To be provided by ASPSPs.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        status:
          description: |
            HTTP response code generated by the server.
            If contained, this is more relevant as the actual http response code in the actual response, because it is introduced by the application server.            
          type: integer
        detail:
          description: |
            Detailed human readable text specific to this instance of the error. 
          allOf:
            - $ref: '#/components/schemas/Max500Text'
        instance:
          description: |
            This attribute is containing a JSON pointer (as defined in [RFC6901]) or XPath expression to indicate the path to an issue generating the error in the related request.
          allOf:
            - $ref: '#/components/schemas/Max256Text'
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_404'
        additionalErrors:
          description: |
            Array of Error Information Blocks.
            Might be used if more than one error is to be communicated
          type: array
          items: #ErrorInformation
            description: This is a data element to support the declaration of additional errors in the context of [RFC7807]. 
            type: object
            required:
              - code
            properties:
              title:
                $ref: '#/components/schemas/Max70Text'
              detail:
                $ref: '#/components/schemas/Max500Text'
              code:
                $ref: '#/components/schemas/MessageCode_ServiceUnspecific_404'
        _links:
          $ref: '#/components/schemas/links'
    AccountIdentificationCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      enum: 
        - AIIN
        - BBAN
        - CUID
        - UPIC
      example: 'AIIN'
    CategoryPurposeCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      enum:
        - BONU
        - CASH
        - CBLK
        - CCRD
        - CORT
        - DCRD
        - DIVI
        - DVPM
        - EPAY
        - FCIN
        - FCOL
        - GP2P
        - GOVT
        - HEDG
        - ICCP
        - IDCP
        - INTC
        - INTE
        - LBOX
        - LOAN
        - MP2B
        - MP2P
        - OTHR
        - PENS
        - RPRE
        - RRCT
        - RVPM
        - SALA
        - SECU
        - SSBE
        - SUPP
        - TAXS
        - TRAD
        - TREA
        - VATX
        - WHLD
        - SWEP
        - TOPG
        - ZABA
        - VOST
        - FCDT
        - CIPC
        - CONC
      example: 'OTHR'
    Max256Text:
      type: string
      maxLength: 256
      example: 'Text, maximum of 256 characters.'
    clearingSystemMemberIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Clearing System Member Identification\" for more details.
      type: object
      properties:
        memberId:
          description: |
            Identification of a member of a clearing system.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        clearingSystemIdentificationCode:
          description: |
            Identification of a clearing system, in a coded form as published in an external list.
          allOf:
            - $ref: '#/components/schemas/ClearingSystemIdentificationCode'
        clearingSystemIdentificationProprietary:
          description: |
            Identification code for a clearing system, that has not yet been identified in the list of clearing systems.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
    organisationIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Organisation Identification\" for more details.
      type: object
      properties:
        anyBIC:
          description: |
            A code allocated to a business entity or to a financial institution by a Registration Authority under an international identification scheme.
          allOf:
            - $ref: '#/components/schemas/BICFI'
        lei:
          description: |
                    Legal Entity Identifier.
          allOf:
            - $ref: '#/components/schemas/LEI'
        others:
          description: |
            Unique identification of an organisation, as assigned by an institution, using an identification scheme.
          type: array
          items:
            $ref: '#/components/schemas/genericOrganisationIdentification'
    extendedPartyDescription:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Extended Party Description\" for more details.
      type: object
      properties:
        name:
          description: |
            Name of the party.
          allOf:
            - $ref: '#/components/schemas/Max140Text'
        postalAddress:
          description: |
            Postal Address of the party.
          allOf:
            - $ref: '#/components/schemas/postalAddress'
        identification:
          description: |
            Identification of the party.
          allOf:
            - $ref: '#/components/schemas/partyIdentification'
        countryOfResidence:
          description: |
            Country in which a person resides (the place of a person's home). 
            In the case of a company, it is the country from which the affairs of that company are directed.
          allOf:
            - $ref: '#/components/schemas/CountryCode'
        contactDetails:
          description: |
            Set of elements used to indicate how to contact the party.
          allOf:
            - $ref: '#/components/schemas/contactDetails'
    agentDescription:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Agent Description\" for more details.
      type: object
      required:
        - financialInstitutionId
      properties:
        financialInstitutionId:
          description: |
          allOf:
            - $ref: '#/components/schemas/financialInstitutionIdentification'
        branchIdentificationId:
          description: |
            Unique and unambiguous identification of a branch of a financial institution.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        branchIdentificationName:
          description: |
            Name by which an agent is known and which is usually used to identify that agent.
          allOf:
            - $ref: '#/components/schemas/Max140Text'
    authenticationObject:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Authentication Object\" for more details.
      type: object
      required:
        - authenticationType
        - authenticationMethodId
        - name
      properties:
        authenticationType:
          description: |
            Type of the authentication method.
          allOf:
            - $ref: '#/components/schemas/AuthenticationType'
        authenticationVersion:
          description: |
            Depending on the \"authenticationType\". This version can be used by differentiating authentication tools used within performing OTP generation in the same authentication type. 
            This version can be referred to in the ASPSP's documentation.
          type: string
        authenticationMethodId:
          description: |
            An identification provided by the ASPSP for the later identification of the authentication method selection.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        name:
          description: |
            This is the name of the authentication method defined by the PSU in the Online Banking frontend of the ASPSP. 
            Alternatively this could be a description provided by the ASPSP like \"SMS OTP on phone +49160 xxxxx 28\".
            This name shall be used by the TPP when presenting a list of authentication methods to the PSU, if available.
          type: string
        explanation:
          description: |
            detailed information about the SCA method for the PSU
          type: string
    duration:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Duration\" for more details.
      type: object
      required:
        - fromDate
      properties:
        fromDate:
          description: |
          allOf:
            - $ref: '#/components/schemas/ISODate'
        toDate:
          description: |
          allOf:
            - $ref: '#/components/schemas/ISODate'
    ReferredDocumentTypeCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Referred Document Type Code\" for more details.
      type: string
      enum:
        - MSIN
        - CNFA
        - DNFA
        - CINV
        - CREN
        - DEBN
        - HIRI
        - SBIN
        - CMCN
        - SOAC
        - DISP
        - BOLD
        - VCHR
        - AROI
        - TSUT
        - PUOR
      example: 'PUOR'
    MandateStatus:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Mandate Status\" for more details.
      type: string
      enum:
        - received
        - rejected
        - partiallyAuthorised
        - valid
        - revokedByPsu
        - expired
        - terminatedByTpp
        - suspended
      example: 'received'
    NamePrefixCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Name Prefix Code\" for more details.
      type: string
      enum:
        - DOCT
        - MADM
        - MISS
        - MIST
        - MIKS
      example: 'MADM'
    error_NG_405_Mandates: 
      type: object
      properties:
        apiClientMessages:
          type: array
          items:
            $ref: '#/components/schemas/clientMessageInformation_405_Mandates'
        _links:
          $ref: '#/components/schemas/links'
    BICFI:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      pattern: '[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}'
      example: 'ECBFDEFFFIM'
    MandateReasonCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Mandate Reason Code\" for more details.
      type: string
      enum:
        - AC01
        - AC04
        - AC06
        - AG01
        - AG02
        - AM02
        - AM03
        - AM05
        - BE01
        - BE04
        - BE05
        - BE06
        - BE07
        - DT01
        - FF01
        - MD01
        - MD02
        - MD07
        - MD08
        - MD09
        - MD10
        - MD11
        - MD12
        - MD13
        - MD14
        - MD15
        - MD16
        - MD17
        - MD18
        - MD19
        - MD20
        - MD21
        - MD22
        - MD23
        - MS02
        - MS03
        - NARR
        - RC01
        - RF01
        - RR01
        - RR02
        - RR03
        - RR04
        - SL01
        - SL11
        - SL12
        - SL13
        - SL14        
      example: 'SL14'
    CountryCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      pattern: '[A-Z]{2}'
      example: 'SE'
    Max140Text:
      type: string
      maxLength: 140
      example: 'Text, maximum of 140 characters.'
    Max512Text:
      type: string
      maxLength: 512
      example: 'Text, maximum of 512 characters.'
    clientMessageInformation_405_Mandates:
      type: object
      required:
        - category
        - code
      properties:
        category:
          description: |
            Only \"ERROR\" or \"WARNING\" permitted
          type: string
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_405'
        path:
          type: string
        text:
          $ref: '#/components/schemas/Max500Text'
    PersonIdentificationCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      enum:
        - ARNU
        - CCPT
        - CUST
        - DRLC
        - EMPL
        - NIDN
        - SOSE
        - TELE
        - TXID
        - POID
      example: 'NIDN'
    amount:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Amount\" for more details.
      type: object
      required:
        - currency
        - amount
      properties:
        currency:
          description: |
            ISO 4217 Alpha 3 currency code
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: |
            The amount given with fractional digits, where fractions must be compliant to the currency definition. Up to 14 significant figures. Negative amounts are signed by minus.
            The decimal separator is a dot.
            Example: Valid representations for EUR with up to two decimals are:
            * 1056
            * 5768.2
            * -1.50
            * 5877.78
          type: string
          pattern: '-?[0-9]{1,14}(\.[0-9]{1,3})?'
    # proxyAccountIdentification:
    #   description: |
    #     See document \"openFinance API Framework Data Dictionary\", section \"Proxy Account Identification\" for more details.
    #   type: object
    #   required:
    #     - identification
    #   properties:
    #     typeCode:
    #       description: |
    #         Type of the proxy identification
    #       allOf:
    #         - $ref: '#/components/schemas/ProxyAccountTypeCode'
    #     typeProprietary:
    #       description: |
    #       allOf:
    #         - $ref: '#/components/schemas/Max35Text'
    #     identification:
    #       description: |
    #       allOf:
    #         - $ref: '#/components/schemas/Max2048Text'
    # ProxyAccountTypeCode:
    #   description: |
    #     See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
    #   type: string
    #   enum:
    #     - TELE
    #     - EMAL
    #     - DNAM
    #     - CINC
    #     - COTX
    #     - COID
    #     - CUST
    #     - DRLC
    #     - EIDN
    #     - EWAL
    #     - PVTX
    #     - LEIC
    #     - MBNO
    #     - NIDN
    #     - CCPT
    #     - SHID
    #     - SOSE
    #     - TOKN
    #     - UBIL
    #     - VIPN
    #     - BIID
    #   example: 'EMAL'
    ExternalLocalInstrumentCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Exchange Rate Type Code\" for more details.
      type: string
      enum:
          - MASAV
        # - 0090
        # - 0091
        # - 0092
        # - 0002
        # - 0221
        # - 0224
        # - 0226
        # - 0225
        # - 0222
        # - 0227
        # - 0220
        # - 0223
        # - 0001
        # - 0000
        # - BTR
        # - CKS
        # - CTR
        # - CTP
        # - DEP
        # - FFR
        # - FFS
        # - SVC
        # - DRW
        # - DRB
        # - DRC
        # - DDMC
        # - DDMP
        # - DDMU
        # - BPA
        # - IPA
        # - TRF
        # - 82
        # - 83
        # - CPP
        # - RTR
        # - GST
        # - DDT
        # - RDD
        # - CHN
        # - STR
        # - SDD
        # - SRT
        # - SRD
        # - SCN
        # - SGT
        # - CARD
        # - 05
        # - 04
        # - ISE
        # - BSE
        # - 58
        # - 19
        # - ASTI
        # - BACP
        # - MANP
        # - SBTI
        # - 85
        # - 08
        # - 89
        # - 60
        # - RIBA
        # - RIDO
        # - RIDV
        # - IDEAL
        # - INSTNT01
        # - INSTTC01
        # - INSTIDEAL
        # - INSTNT01IDEAL
        # - INSTTC01IDEAL
        # - NLDO
        # - NLUP
        # - SDN
        # - ACCEPT
        # - ICMC
        # - NLGOV
        # - IN
        # - ONCL
        # - PERI
        # - SDCL
        # - DDNR
        # - DDFA
        # - CORE
        # - B2BAMIPM
        # - B2B
        # - CR1AMIPM
        # - CORAMIPM
        # - COR1
        # - FADAMIPM
        # - CLSCCPERX
        # - CLSCCPLCH
        # - INST
        # - ADD
        # - UDD
        # - CCI
        # - IAT
        # - CCD
        # - CTX
        # - PPD
        # - CIE
        # - RCK
        # - ARC
        # - WEB
        # - POP
        # - POS
        # - TEL
        # - ITP
        # - CTP
        # - MDP
        # - IMD
        # - SOP
        # - FDP
      example: 'MASAV'
    MessageCode_ServiceUnspecific_409:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Service Unspecific HTTP Error Codes\" for more details.
      enum: 
          - STATUS_INVALID
      example: 'STATUS_INVALID'
    contactDetails:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Contact Details\" for more details.
      type: object
      properties:
        namePrefix:
          description: |
            Specifies the terms used to formally address a person.
          allOf:
            - $ref: '#/components/schemas/NamePrefixCode'
        name:
          description: |
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        phoneNumber:
          description: |
            pattern \+[0-9]{1,3}-[0-9()+\-]{1,30}
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        mobileNumber:
          description: |
            pattern \+[0-9]{1,3}-[0-9()+\-]{1,30}
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        faxNumber:
          description: |
            pattern \+[0-9]{1,3}-[0-9()+\-]{1,30}
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        emailAddress:
          description: |
            Address for electronic mail (e-mail).
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        emailPurpose:
          description: |
            Purpose for which an email address may be used.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        jobTitle:
          description: |
            Title of the function.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        responsibility:
          description: |
            Role of a person in an organisation.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        department:
          description: |
            Identification of a division of a large organisation or building.
          allOf:
            - $ref: '#/components/schemas/Max35Text'
        preferredMethod:
          description: |
            Preferred method used to reach the contact.
          allOf:
            - $ref: '#/components/schemas/PreferredMethod'
    error_RFC7807_409_Mandates: 
      description: |
        Standardised definition of reporting error information according to [RFC7807].
      type: object
      required:
        - type
        - code
      properties:
        type: 
          description: |
            A URI reference [RFC3986] that identifies the problem type. 
            Remark For Future: These URI will be provided by NextGenPSD2 in future.
          type: string
          format: uri
          maxLength: 70
        title:
          description: |
            Short human readable description of error type. Could be in local language. To be provided by ASPSPs.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        status:
          description: |
            HTTP response code generated by the server.
            If contained, this is more relevant as the actual http response code in the actual response, because it is introduced by the application server.            
          type: integer
        detail:
          description: |
            Detailed human readable text specific to this instance of the error. 
          allOf:
            - $ref: '#/components/schemas/Max500Text'
        instance:
          description: |
            This attribute is containing a JSON pointer (as defined in [RFC6901]) or XPath expression to indicate the path to an issue generating the error in the related request.
          allOf:
            - $ref: '#/components/schemas/Max256Text'
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_409'
        additionalErrors:
          description: |
            Array of Error Information Blocks.
            Might be used if more than one error is to be communicated
          type: array
          items: #ErrorInformation
            description: This is a data element to support the declaration of additional errors in the context of [RFC7807]. 
            type: object
            required:
              - code
            properties:
              title:
                $ref: '#/components/schemas/Max70Text'
              detail:
                $ref: '#/components/schemas/Max500Text'
              code:
                $ref: '#/components/schemas/MessageCode_ServiceUnspecific_409'
        _links:
          $ref: '#/components/schemas/links'
    FinancialInstitutionIdentificationCode:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
    MessageCode_ServiceUnspecific_405:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Service Unspecific HTTP Error Codes\" for more details.
      type: string
      enum: 
        - SERVICE_INVALID
      example: 'SERVICE_INVALID'
    ISODate:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      format: date
      example: '2020-01-01'
    LEI:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      pattern: '[A-Z0-9]{18,18}[0-9]{2,2}'
      example: '549300DTUYXVMJXZNY75'
    MessageCode_ServiceUnspecific_404:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Service Unspecific HTTP Error Codes\" for more details.
      type: string
      enum: 
        - RESOURCE_UNKNOWN
      example: 'RESOURCE_UNKNOWN'
    BBAN:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Other ISO-related basic Types\" for more details.
      type: string
      #pattern: '[a-zA-Z0-9]{1,30}' 
      #example: 'BARC12345612345678'
    MessageCode_ServiceUnspecific_403:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Service Unspecific HTTP Error Codes\" for more details.
      type: string
      enum: 
        - SERVICE_BLOCKED
        - CONSENT_UNKNOWN
        - RESOURCE_UNKNOWN
        - RESOURCE_EXPIRED
      example: 'SERVICE_BLOCKED'
    clientMessageInformation_401_Mandates:
      type: object
      required:
        - category
        - code
      properties:
        category:
          description: |
            Only \"ERROR\" or \"WARNING\" permitted
          type: string
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_401'
        path:
          type: string
        text:
          $ref: '#/components/schemas/Max500Text'
    MessageCode_ServiceUnspecific_401:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Service Unspecific HTTP Error Codes\" for more details.
      type: string
      enum: 
        - CERTIFICATE_INVALID
        - ROLE_INVALID
        - CERTIFICATE_EXPIRED
        - CERTIFICATE_BLOCKED
        - CERTIFICATE_REVOKED
        - CERTIFICATE_MISSING
        - CLIENT_INVALID
        - CLIENT_INCONSISTENT
        - SIGNATURE_INVALID
        - SIGNATURE_MISSING
        - ROLE_INVALID
        - PSU_CREDENTIALS_INVALID
        - CORPORATE_ID_INVALID
        - CONSENT_INVALID
        - CONSENT_EXPIRED
        - TOKEN_UNKNOWN
        - TOKEN_INVALID
        - TOKEN_EXPIRED
      example: 'CERTIFICATE_INVALID'
    MessageCode_ServiceUnspecific_400:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Service Unspecific HTTP Error Codes\" for more details.
      type: string
      enum: 
        - FORMAT_ERROR
        - PARAMETER_NOT_CONSISTENT
        - PARAMETER_NOT_SUPPORTED
        - SERVICE_INVALID
        - CONSENT_UNKNOWN
        - RESOURCE_UNKNOWN
        - RESOURCE_EXPIRED
        - RESOURCE_BLOCKED
        - TIMESTAMP_INVALID
        - PERIOD_INVALID
        - SCA_METHOD_UNKNOWN
        - SCA_INVALID
      example: 'FORMAT_ERROR'
    error_NG_401_Mandates: 
      type: object
      properties:
        apiClientMessages:
          type: array
          items:
            $ref: '#/components/schemas/clientMessageInformation_401_Mandates'
        _links:
          $ref: '#/components/schemas/links'
    challenge:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Challenge\" for more details.
      type: object
      properties:
        image:
          description: |
            PNG data (max. 512 kilobyte) to be displayed to the PSU, Base64 encoding, cp. [RFC4648].
            This attribute is used only, when PHOTO_OTP or CHIP_OTP is the selected SCA method.
          type: string
        data:
          description: |
            A collection of challenge data
          type: array
          items: 
            type: string
        imageLink:
          description: |
            A link where the ASPSP will provides the challenge image for the TPP.
          type: string
        otpMaxLength:
          description: |
            The maximal length for the OTP to be typed in by the PSU.
          type: integer
        otpFormat:
          description: |
            The format type of the OTP to be typed in. The admitted values are \"characters\" or \"integer\".
          type: string
        additionalInformation:
          description: |
            Additional explanation for the PSU to explain e.g. fallback mechanism for the chosen SCA method. The TPP is obliged to show this to the PSU.
          type: string
    error_RFC7807_403_Mandates: 
      description: |
        Standardised definition of reporting error information according to [RFC7807].
      type: object
      required:
        - type
        - code
      properties:
        type: 
          description: |
            A URI reference [RFC3986] that identifies the problem type. 
            Remark For Future: These URI will be provided by NextGenPSD2 in future.
          type: string
          format: uri
          maxLength: 70
        title:
          description: |
            Short human readable description of error type. Could be in local language. To be provided by ASPSPs.
          allOf:
            - $ref: '#/components/schemas/Max70Text'
        status:
          description: |
            HTTP response code generated by the server.
            If contained, this is more relevant as the actual http response code in the actual response, because it is introduced by the application server.            
          type: integer
        detail:
          description: |
            Detailed human readable text specific to this instance of the error. 
          allOf:
            - $ref: '#/components/schemas/Max500Text'
        instance:
          description: |
            This attribute is containing a JSON pointer (as defined in [RFC6901]) or XPath expression to indicate the path to an issue generating the error in the related request.
          allOf:
            - $ref: '#/components/schemas/Max256Text'
        code:
          $ref: '#/components/schemas/MessageCode_ServiceUnspecific_403'
        additionalErrors:
          description: |
            Array of Error Information Blocks.
            Might be used if more than one error is to be communicated
          type: array
          items: #ErrorInformation
            description: This is a data element to support the declaration of additional errors in the context of [RFC7807]. 
            type: object
            required:
              - code
            properties:
              title:
                $ref: '#/components/schemas/Max70Text'
              detail:
                $ref: '#/components/schemas/Max500Text'
              code:
                $ref: '#/components/schemas/MessageCode_ServiceUnspecific_403'
        _links:
          $ref: '#/components/schemas/links'
    partyIdentification:
      description: |
        See document \"openFinance API Framework Data Dictionary\", section \"Party Identification\" for more details.
      type: object
      properties:
        organisationId:
          description: |
            An entry provided by an external ISO code list
          allOf:
            - $ref: '#/components/schemas/organisationIdentification'
        privateId:
          description: |
            A scheme name defined in a proprietary way.
          allOf:
            - $ref: '#/components/schemas/privateIdentification'
  parameters:
    X-Request-ID:
      name: X-Request-ID
      in: header
      description: ID of the request, unique to the call, as determined by the initiating party.
      required: true
      example: "99391c7e-ad88-49ec-a2ad-99ddcb1f7721"
      schema:
        type: string
        format: uuid

    #BOI-REMARK: signing request messages is mandatory for TPP on all requests. The TPPhas to use QSEALC certificate issued by Gov CA in order to sign request messages.

    Digest:
      name: Digest
      in: header
      description: Is contained if and only if the "Signature" element is contained in the header of the request.
      schema:
        type: string
      required: true # conditional
      example: "SHA-256=hl1/Eps8BEQW58FJhDApwJXjGY4nr1ArGDHIT25vq6A="

    #BOI-REMARK: signing request messages is mandatory for TPP on all requests. The TPPhas to use QSEALC certificate issued by Gov CA in order to sign request messages.

    Signature:
      name: Signature
      in: header
      description: |
        A signature of the request by the TPP on application level. This might be mandated by ASPSP.
      schema:
        type: string
      required: true # conditional
      example: >
        keyId="SN=9FA1,CA=CN=D-TRUST%20CA%202-1%202015,O=D-Trust%20GmbH,C=DE",algorithm="rsa-sha256",
        headers="Digest X-Request-ID PSU-ID TPP-Redirect-URI Date",
        signature="Base64(RSA-SHA256(signing string))"

    #BOI-REMARK: signing request messages is mandatory for TPP on all requests. The TPPhas to use QSEALC certificate issued by Gov CA in order to sign request messages.

    TPP-Signature-Certificate:
      name: TPP-Signature-Certificate
      in: header
      description: |
        The certificate used for signing the request, in base64 encoding.
        Must be contained if a signature is contained.
      schema:
        type: string
        format: byte
      required: true # conditional


    TPP-Redirect-Preferred:
      name: TPP-Redirect-Preferred
      in: header
      description: |
       BOI-REMARK- If it equals "false" , the ASPSP has to choose Decoupled SCA approach if supported by the ASPSP for the related PSU, because Embedded does not supported.
        ASPSP not supporting Decoupled SCA approach can ignore this attribute.
      schema:
        type: boolean
      required: false


    TPP-Decoupled-Preferred:
      name: TPP-Decoupled-Preferred
      in: header
      description: |
        If it equals "true", the TPP prefers a decoupled SCA approach.
        If it equals "false", the TPP prefers not to use the decoupled approach for SCA. The ASPSP will then choose between the embedded or the redirect SCA approach, depending on the choice of the SCA procedure by the TPP/PSU.
        If the parameter is not used, the ASPSP will choose the SCA approach to be applied depending on the parameter TPP-Redirect-Preferred and the SCA method chosen by the TPP/PSU.
        The parameter might be ignored by the ASPSP.
        If both parameters TPP-Redirect-Preferred and TPP-Decoupled-Preferred are present and true, the request is still not rejected, but it is up to the ASPSP, which approach will actually be used.

        **Remark for Future:**
        TPP-Redirect-Preferred and TPP-Decoupled-Preferred will be revised in future versions, maybe merged. Currently kept separate for downward compatibility.
      schema:
        type: boolean
      required: false


    TPP-Redirect-URI:
      name: TPP-Redirect-URI
      in: header
      description: |
        URI of the TPP, where the transaction flow shall be redirected to after a Redirect.

        Mandated for the Redirect SCA Approach, specifically
        when TPP-Redirect-Preferred equals "true".
        It is recommended to always use this header field.

        **Remark for Future:**
        This field might be changed to mandatory in the next version of the specification.
      schema:
        type: string
        format: uri
        maxLength: 2048

      required: false # conditional


    TPP-Nok-Redirect-URI:
      name: TPP-Nok-Redirect-URI
      in: header
      description: |
        If this URI is contained, the TPP is asking to redirect the transaction flow to this address instead of the TPP-Redirect-URI in case
        of a negative result of the redirect SCA method. This might be ignored by the ASPSP.
      schema:
        type: string
        format: uri
        maxLength: 2048
      required: false


    TPP-Explicit-Authorisation-Preferred:
      name: TPP-Explicit-Authorisation-Preferred
      in: header
      description: |
        If it equals "true", the TPP prefers to start the authorisation process separately,
        e.g. because of the usage of a signing basket.
        This preference might be ignored by the ASPSP, if a signing basket is not supported as functionality.

        If it equals "false" or if the parameter is not used, there is no preference of the TPP.
        This especially indicates that the TPP assumes a direct authorisation of the transaction in the next step,
        without using a signing basket.
      schema:
        type: boolean
      required: false

    TPP-Rejection-NoFunds-Preferred:
      name: TPP-Rejection-NoFunds-Preferred
      in: header
      description: |
        If it equals "true" then the TPP prefers a rejection of the payment initiation in case the ASPSP is
        providing an integrated confirmation of funds request an the result of this is that not sufficient
        funds are available.

        If it equals "false" then the TPP prefers that the ASPSP is dealing with the payment initiation like
        in the ASPSPs online channel, potentially waiting for a certain time period for funds to arrive to initiate the payment.

        This parameter might be ignored by the ASPSP.

      schema:
        type: boolean
      required: false


    TPP-Brand-Logging-Information:
      name: TPP-Brand-Logging-Information
      in: header
      description: |
        This header might be used by TPPs to inform the ASPSP about the brand used by the TPP towards the PSU.
        This information is meant for logging entries to enhance communication between ASPSP and PSU or ASPSP and TPP.
        This header might be ignored by the ASPSP.

      schema:
        type: string
      required: false


    TPP-Notification-URI:
      name: TPP-Notification-URI
      in: header
      description: |
        URI for the Endpoint of the TPP-API to which the status of the payment initiation should be sent.
        This header field may by ignored by the ASPSP.

        For security reasons, it shall be ensured that the TPP-Notification-URI as introduced above is secured by the TPP eIDAS QWAC used for identification of the TPP. The following applies:

        URIs which are provided by TPPs in TPP-Notification-URI shall comply with the domain secured by the eIDAS QWAC certificate of the TPP in the field CN or SubjectAltName of the certificate. Please note that in case of example-TPP.com as certificate entry TPP- Notification-URI like www.example-TPP.com/xs2a-client/v1/ASPSPidentifcation/mytransaction- id/notifications or notifications.example-TPP.com/xs2a-client/v1/ASPSPidentifcation/mytransaction- id/notifications would be compliant.

        Wildcard definitions shall be taken into account for compliance checks by the ASPSP.
         ASPSPs may respond with ASPSP-Notification-Support set to false, if the provided URIs do not comply.
      schema:
        type: string
        format: uri
        maxLength: 2048
      required: false

    TPP-Notification-URI_mandatory:
      name: TPP-Notification-URI
      in: header
      description: |
        URI for the Endpoint of the TPP-API to which the status of the consent status should be sent.

        For security reasons, it shall be ensured that the TPP-Notification-URI as introduced above is secured by the TPP eIDAS QWAC used for identification of the TPP. The following applies:

        URIs which are provided by TPPs in TPP-Notification-URI shall comply with the domain secured by the eIDAS QWAC certificate of the TPP in the field CN or SubjectAltName of the certificate. Please note that in case of example-TPP.com as certificate entry TPP- Notification-URI like www.example-TPP.com/xs2a-client/v1/ASPSPidentifcation/mytransaction- id/notifications or notifications.example-TPP.com/xs2a-client/v1/ASPSPidentifcation/mytransaction- id/notifications would be compliant.

        Wildcard definitions shall be taken into account for compliance checks by the ASPSP.
         ASPSPs may respond with ASPSP-Notification-Support set to false, if the provided URIs do not comply.
      schema:
        type: string
        format: uri
        maxLength: 2048
      required: true


    TPP-Notification-Content-Preferred:
      name: TPP-Notification-Content-Preferred
      in: header
      description: |
        The string has the form

        status=X1, ..., Xn

        where Xi is one of the constants SCA, PROCESS, LAST and where constants are not
        repeated.
        The usage of the constants supports the of following semantics:

          SCA: A notification on every change of the scaStatus attribute for all related authorisation processes is preferred by the TPP.

          PROCESS: A notification on all changes of consentStatus or transactionStatus attributes is preferred by the TPP.
          LAST: Only a notification on the last consentStatus or transactionStatus as available in the XS2A interface is preferred by the TPP.

        This header field may be ignored, if the ASPSP does not support resource notification services for the related TPP.
      schema:
        type: string
        maxLength: 2048
      required: false


    PSU-ID:
      name: PSU-ID
      in: header
      description: |
        BOI-REMARK - The PSU id number or passport number.
        Possible values are:
        * ID = only digits.
        * Passport =  2 characters ISO 3166 country code + '-' + Passport number.
      schema:
        type: string
        pattern: "^([0-9]{9}|[A-Za-z]{2}-([A-Za-z0-9]){1,16})$"
      required: true
      example: "IL-12345678945"


    PSU-ID-Type:
      name: PSU-ID-Type
      in: header
      description: |
        BOI-REMARK - Specific brands or channels of the ASPSP only in case there is more than one.
        Possible values should be found in ASPSP's documentation and get approved in advance by BOI.
      schema:
        type: string
        maxLength: 512

      required: false


    PSU-Corporate-ID:
      name: PSU-Corporate-ID
      in: header
      description: |
        Might be mandated in the ASPSP's documentation. Only used in a corporate context.
      schema:
        type: string
        pattern: '^[A-Z]{2}[-]\d{9}|\d{9}$'
      required: false


    PSU-Corporate-ID-Type:
      name: PSU-Corporate-ID-Type
      in: header
      description: |
        Might be mandated in the ASPSP's documentation. Only used in a corporate context.
      schema:
        type: string
        maxLength: 512
      required: false


    PSU-IP-Address_mandatory:
      name: PSU-IP-Address
      in: header
      description: |
        The forwarded IP Address header field consists of the corresponding http request IP Address field between PSU and TPP.
        If not available, the TPP shall use the IP Address used by the TPP when submitting this request.
      schema:
        type: string
        format: ipv4
      required: true
      example: 192.168.8.78


    PSU-IP-Address_optional:
      name: PSU-IP-Address
      in: header
      description: |
        The forwarded IP Address header field consists of the corresponding http request IP Address field between PSU and TPP.
      schema:
        type: string
        format: ipv4
      required: false
      example: 192.168.8.78


    PSU-IP-Address_conditionalForAis:
      name: PSU-IP-Address
      in: header
      description: |
        The forwarded IP Address header field consists of the corresponding HTTP request
        IP Address field between PSU and TPP.
        It shall be contained if and only if this request was actively initiated by the PSU.
      schema:
        type: string
        format: ipv4
      required: false
      example: 192.168.8.78

    PSU-IP-Port:
      name: PSU-IP-Port
      in: header
      description: |
        The forwarded IP Port header field consists of the corresponding HTTP request IP Port field between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 5
      required: false
      example: "1234"

    PSU-IP-Port_mandatory:
      name: PSU-IP-Port
      in: header
      description: |
        The forwarded IP Port header field consists of the corresponding HTTP request IP Port field between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 5
      required: false
      example: "1234"

    PSU-Accept:
      name: PSU-Accept
      in: header
      description: |
        The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 1024
      required: false


    PSU-Accept-Charset:
      name: PSU-Accept-Charset
      in: header
      description: |
        The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 1024
      required: false


    PSU-Accept-Encoding:
      name: PSU-Accept-Encoding
      in: header
      description: |
        The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 1024
      required: false


    PSU-Accept-Language:
      name: PSU-Accept-Language
      in: header
      description: |
        The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 1024
      required: false


    PSU-User-Agent:
      name: PSU-User-Agent
      in: header
      description: |
        The forwarded Agent header field of the HTTP request between PSU and TPP, if available.
      schema:
        type: string
        maxLength: 1024
      required: false


    PSU-Http-Method:
      name: PSU-Http-Method
      in: header
      description: |
        HTTP method used at the PSU ? TPP interface, if available.
        Valid values are:
        * GET
        * POST
        * PUT
        * PATCH
        * DELETE
      schema:
        type: string
        enum:
          - "GET"
          - "POST"
          - "PUT"
          - "PATCH"
          - "DELETE"
      required: false


    PSU-Device-ID:
      name: PSU-Device-ID
      in: header
      description: |
        UUID (Universally Unique Identifier) for a device, which is used by the PSU, if available.
        UUID identifies either a device or a device dependant application installation.
        In case of an installation identification this ID needs to be unaltered until removal from device.
      schema:
        type: string
        format: uuid
      required: false
      example: "99435c7e-ad88-49ec-a2ad-99ddcb1f5555"

    PSU-Device-ID_conditional:
      name: PSU-Device-ID
      in: header
      description: |
        UUID (Universally Unique Identifier) for a device, which is used by the PSU, if available.
        UUID identifies either a device or a device dependant application installation.
        In case of an installation identification this ID need to be unaltered until removal from device.
      schema:
        type: string
        format: uuid
      required: false
      example: "99435c7e-ad88-49ec-a2ad-99ddcb1f5555"

    PSU-Geo-Location:
      name: PSU-Geo-Location
      in: header
      description: |
        The forwarded Geo Location of the corresponding http request between PSU and TPP if available.
      schema:
        type: string
        pattern: '^GEO:-?[0-9]{1,2}\.[0-9]{6};-?[0-9]{1,3}\.[0-9]{6}$'
      required: false
      example: GEO:52.506931;13.144558

    PSU-Geo-Location_conditional:
      name: PSU-Geo-Location
      in: header
      description: |
        The forwarded Geo Location of the corresponding http request between PSU and TPP if available.
      schema:
        type: string
        pattern: '^GEO:-?[0-9]{1,2}\.[0-9]{6};-?[0-9]{1,3}\.[0-9]{6}$'
      required: false
      example: GEO:52.506931;13.144558


    HEADER_contentType_mandatory:
      name: Content-Type
      in: header
      description: |
      required: true
      schema:
        type: string
      example: 'application/json'

    
    # HEADER_xJwsSignature:
    #   name: x-jws-signature
    #   in: header
    #   description: |
    #     The attribute x-jws-signature contains the JSON Web Signature.
    #   schema:
    #     type: string
    #   required: false # conditional
    #   example: 'eyJiNjQiOmZhbHNlLCJ4NXQjUzI1NiI6ImR5dFBwU2tKWXpoVGRQWFNXUDdqaFhnRzRrQ09XSVdHaWVzZHprdk5MelkiLCJjcml0IjpbInNpZ1QiLCJzaWdEIiwiYjY0Il0sInNpZ1QiOiIyMDIwLTEwLTI2VDExOjI2OjU3WiIsInNpZ0QiOnsicGFycyI6WyJ4LXJlcXVlc3QtaWQiLCJkaWdlc3QiXSwibUlkIjoiaHR0cDovL3VyaS5ldHNpLm9yZy8xOTE4Mi9IdHRwSGVhZGVycyJ9LCJhbGciOiJSUzI1NiJ9..NuGglWBtHcXavob2ZmW-PoSpMmhJS9U6z8zPqHFoE97vHI3z8wtaVdbwsj5WzgPjtVWUUnk8cxP4JjLXdwzwhhHB2uJ5FI4ZZGdSQQw-9pXPUx3cCJSzHmrgkJ-di-A4'
    HEADER_digest:
      name: Digest
      in: header
      description: |
        When API Client include a signature according to this signature profile, they also must include a \"Digest\" header as defined in [RFC3230]. 
        The \"Digest\" Header contains a Hash of the message body. If the message does not contain a body, the \"Digest\" header must contain the hash of an empty byte list.
        The only hash algorithms that may be used to calculate the Digest within the context of this specification are SHA-256 and SHA-512 as defined in [RFC5843]. 
      schema:
        type: string
      required: false # conditional
      example: 'SHA-256=hl1/Eps8BEQW58FJhDApwJXjGY4nr1ArGDHIT25vq6A='
    HEADER_xRequestId:
      name: X-Request-ID
      in: header
      description: ID of the request, unique to the call, as determined by the initiating party.
      required: true
      schema:
        type: string
        format: uuid
      example: '99391c7e-ad88-49ec-a2ad-99ddcb1f7721'
    PATH_resourceId:
      name: resourceId
      in: path
      description: |
        Resource identification of the related payment initiation, signing basket, consent, subscription or other related business transaction resource. 
      required: true
      schema:
        $ref: '#/components/schemas/Max70Text'
      example: '1234-resource-567'
    HEADER_psuIpAddress_mandatory:
      name: PSU-IP-Address
      in: header
      description: |
        The forwarded IP Address header field consists of the corresponding http request IP Address field between PSU and TPP.
        If not available, the TPP shall use the IP Address used by the TPP when submitting this request.
      schema:
        type: string
        format: ipv4
      required: true
      example: '192.168.8.78'
  requestBodies: {}
  headers:
    ASPSP-SCA-Approach:
      description: |
        This data element must be contained, if the SCA Approach is already fixed.
        Possible values are
          * DECOUPLED
          * REDIRECT
        The OAuth SCA approach will be subsumed by REDIRECT.
      schema:
        type: string
        enum:
          - "DECOUPLED"
          - "REDIRECT"
        example: "REDIRECT"
      required: false
    #conditional for extended service multiple Consent
    ASPSP-Multiple-Consent-Support:
      description: |
        true if the ASPSP supports the Multiple Consent Service.

        false if the ASPSP does not support the Multiple Consent Service.

        If not provided, this also implies that the ASPSP does not support the Multiple Consent Service.
      schema:
        type: boolean
      required: false

    ASPSP-Notification-Support:
      description: |
        true if the ASPSP supports resource status notification services.
        false if the ASPSP supports resource status notification in general, but not for the current request.
        Not used, if resource status notification services are generally not supported by the ASPSP.
        Shall be supported if the ASPSP supports resource status notification services.
      schema:
        type: boolean       
      required: false
      example: true
    # X-Reference-API-Version:
      # description: ID of the request, unique to the call, as determined by the initiating party.
      # required: true
      # schema:
      #   type: string
      # example: '2.1.3'
    # X-Reference-API-Document:
      # description: |
      #   The name of the Implementation Guideline document, where the service is based on, e.g. \"Extended Payment Initiation Services\". 
      # required: false
      # schema:
      #   type: string
      # example: 'Extended Payment Initiation Services'
    X-Request-ID:
      description: |
        ID of the request, unique to the call, as determined by the initiating party.
      required: true
      schema:
        type: string
        format: uuid
      example: '99391c7e-ad88-49ec-a2ad-99ddcb1f7721'
    # # X-Reference-API-Name:
    #   description: |
    #     \"Berlin Group openFinance API\" 
    #   required: false
    #   schema:
    #     type: string
    #   example: 'Berlin Group openFinance API'
    ASPSP-Notification-Content:
      description: |
        The string has the form
        status=X1, ..., Xn
        where Xi is one of the constants SCA, PROCESS, LAST and where constants are not repeated.
        The usage of the constants supports the following semantics
        SCA - Notification on every change of the scaStatus attribute for all related authorisation processes is provided by the ASPSP for the related resource.
        PROCESS - Notification on all changes of consentStatus or transactionStatus attributes is provided by the ASPSP for the related resource
        LAST - Notification on the last consentStatus or transactionStatus as available in the XS2A interface is provided by the ASPSP for the related resource.
        This field must be provided if the ASPSP-Notification-Support=true. The ASPSP might consider the notification content as preferred by the TPP, but can also respond independently of the preferred request    
      schema:
        type: string        
      required: false
      example: 'status=SCA'
    Location:
      description: |
        Location of the created resource.
      schema:
        type: string
        format: url
      required: false
      example: 'https://testbank.com/xs2a/v2/consents/account-access/123cons456'
  responses:
    created_204_Mandates:
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      description: NO CONTENT
    created_201_Mandates:
      headers:
        # # X-Reference-API-Name:
        # #   $ref: '#/components/headers/X-Reference-API-Name'
        # # X-Reference-API-Document:
        # #   $ref: '#/components/headers/X-Reference-API-Document'
        # # X-Reference-API-Version:
        # #   $ref: '#/components/headers/X-Reference-API-Version'
        # ASPSP-Notification-Support:
        #   $ref: '#/components/headers/ASPSP-Notification-Support'
        # ASPSP-Notification-Content:
        #   $ref: '#/components/headers/ASPSP-Notification-Content'
        # Location:
        #   $ref: '#/components/headers/Location'
        # X-Request-ID:
        #   $ref: '#/components/headers/X-Request-ID'
        X-Request-ID:
          $ref: "#/components/headers/X-Request-ID"
        Location:
          $ref: "#/components/headers/Location"
        ASPSP-SCA-Approach:
          $ref: "#/components/headers/ASPSP-SCA-Approach"
        #conditional for extended service lean Push
        ASPSP-Notification-Support:
          $ref: "#/components/headers/ASPSP-Notification-Support"
        ASPSP-Notification-Content:
          $ref: "#/components/headers/ASPSP-Notification-Content"
      description: CREATED
      content:
        application/json:
          schema:
            type: object
            required:
              - mandateResourceId
              - mandateStatus
              - _links
            properties:
              mandateResourceId:
                description: |
                  Technical resource identification
                allOf:
                  - $ref: '#/components/schemas/UUID'
              mandateStatus:
                description: |
                  authentication status of the mandate
                allOf:
                  - $ref: '#/components/schemas/MandateStatus'
              mandateReasonCode:
                description: |
                  Mandate reason code
                allOf:
                  - $ref: '#/components/schemas/MandateReasonCode'
              mandateReasonProprietary:
                description: |
                  Propietary mandate reason code
                allOf:
                  - $ref: '#/components/schemas/Max35Text'
              # scaMethods:
              #   description: |
              #     This data element might be contained, if SCA is required and if the PSU has a choice between different
              #     authentication methods.
              #     Depending on the risk management of the ASPSP this choice might be offered before or after the PSU
              #     has been identified with the first relevant factor, or if an access token is transported.
              #     If this data element is contained, then there is also a hyperlink of type \"startAuthorisationWithAuthenticationMethodSelection\"
              #     contained in the response body.
              #     These methods shall be presented towards the PSU for selection by the TPP.
              #   type: array
              #   items:
              #     $ref: '#/components/schemas/authenticationObject'
              # chosenScaMethod:
              #   description: |
              #     This data element is only contained in the response if the ASPSP has chosen the Embedded SCA Approach, if the PSU is already identified e.g. 
              #     with the first relevant factor or alternatively an access token, if SCA is required and if the authentication method is implicitly selected.
              #   allOf:
              #     - $ref: '#/components/schemas/authenticationObject'
              # challengeData:
              #   description: |
              #     It is contained in addition to the data element \"chosenScaMethod\" if challenge data is needed for SCA.
              #     In rare cases this attribute is also used in the context of the \"startAuthorisationWithPsuAuthentication\" or 
              #     \"startAuthorisactionWithEncryptedPsuAuthentication\" link. 
              #   allOf:
              #     - $ref: '#/components/schemas/challenge'
              _links:
                description: |
                  A list of hyperlinks to be recognised by the API Client.                   
                  Type of links admitted in this response (which might be extended by single ASPSPs as indicated in its documentation) are defined in [oFA SMPF] generically for all Transaction Initiation Response messages. 
                allOf:
                  - $ref: '#/components/schemas/_links_201_Mandates'
              psuMessage:
                description: |
                  Text to be displayed to the PSU, e.g. in a Decoupled SCA Approach
                allOf:
                  - $ref: '#/components/schemas/Max512Text'
    RECEIVED_202_MandatesCancel:
      description: Received
      headers:
        X-Request-ID:
          $ref: "#/components/headers/X-Request-ID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/mandatesCancelResponse-202"
          
    decline_400_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_NG_400_Mandates'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/error_RFC7807_400_Mandates'
    decline_403_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_NG_403_Mandates'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/error_RFC7807_403_Mandates'
    Ok_200_Mandates_Status:
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      description: OK
      content:
        application/json:
          schema:
            type: object
            required:
              - mandateStatus
            properties:
              mandateStatus:
                description: |
                  This is the overall lifecycle status of the mandate.
                allOf:
                  - $ref: '#/components/schemas/MandateStatus'
              mandateReasonCode:
                description: |
                  Mandate reason code.
                allOf:
                  - $ref: '#/components/schemas/MandateReasonCode'
              mandateReasonProprietary:
                description: |
                  Proprietary mandate reason code.
                allOf:
                  - $ref: '#/components/schemas/Max35Text'
    decline_409_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_NG_409_Mandates'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/error_RFC7807_409_Mandates'
    decline_415_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Unsupported Media Type
    decline_406_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Not Acceptable
    decline_503:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Service Unavailable
    decline_415:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Unsupported Media Type
    decline_500:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Internal Server Error
    decline_408:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Request Timeout
    decline_405_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Method not allowed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_NG_405_Mandates'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/error_RFC7807_405_Mandates'
    decline_406:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Not Acceptable
    decline_401_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Unauthorised
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_NG_401_Mandates'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/error_RFC7807_401_Mandates'
    decline_404_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_NG_404_Mandates'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/error_RFC7807_404_Mandates'
    Ok_200_Mandates:
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      description: OK
      content:
        application/json:
          schema:
            type: object
            required:
              - mandateId
              - type
              - creditor
              - creditorAccount
              - debtor
              - mandateStatus
              - lastActionDate
              - debtorAccount
            properties:
              mandateId:
                description: |
                  Unique identification, as assigned by the creditor, to unambiguously identify the mandate.
                allOf:
                  - $ref: '#/components/schemas/Max35Text'
              type:
                description: |
                  Specifies the type of mandate, such as paper, electronic or scheme.
                allOf:
                  - $ref: '#/components/schemas/mandateType'
              occurrences:
                description: |
                  Provides details of the duration of the mandate and occurrence of the underlying direct debit transactions.
                allOf:
                  - $ref: '#/components/schemas/ocurrences'
              firstCollectionAmount:
                description: |
                  Amount different from the collection amount, as it includes the costs associated with the first debited amount.
                allOf:
                  - $ref: '#/components/schemas/amount'
              collectionAmount:
                description: |
                  Fixed amount to be collected from the debtor's account
                allOf:
                  - $ref: '#/components/schemas/amount'
              maximumAmount:
                description: |
                  Maximum amount that may be collected from the debtor's account, per instruction.
                allOf:
                  - $ref: '#/components/schemas/amount'
              reasonCode:
                description: |
                  Provides the reason for the setup of the mandate as an ISO code.
                allOf:
                  - $ref: '#/components/schemas/MandateSetupReasonCode'
              reasonProprietary:
                description: |
                  Provides the reason for the setup of the mandate as a proprietary code.
                allOf:
                  - $ref: '#/components/schemas/Max35Text'
              creditorSchemeIdentification:
                description: |
                  Credit party that signs the mandate. Could be mandated by ASPSP to fulfil requirements of the related direct debit schemes.
                allOf:
                  - $ref: '#/components/schemas/extendedPartyDescription'
              creditor:
                description: |
                  Party that signs the mandate and to whom an amount of money is due.
                allOf:
                  - $ref: '#/components/schemas/extendedPartyDescription'
              creditorAccount:
                description: |
                  This attribute is optional by default, but maybe mandated by ASPSPs or Direct Debit Schemes. If so, this must be documented accordingly in e.g. related Discovery Services.
                allOf:
                  - $ref: '#/components/schemas/accountReference'
              creditorAgent:
                description: |
                allOf:
                  - $ref: '#/components/schemas/agentDescription'
              ultimateCreditor:
                description: |
                allOf:
                  - $ref: '#/components/schemas/extendedPartyDescription'
              debtor:
                description: |
                  In case of synchronous authorisation, this attribute might be made optional by rules of direct debit schemes or the implementing ASPSP in case the debtorAccount is provided. 
                allOf:
                  - $ref: '#/components/schemas/extendedPartyDescription'
              debtorAccount:
                description: |
                allOf:
                  - $ref: '#/components/schemas/accountReference'
              ultimateDebtor:
                description: |
                allOf:
                  - $ref: '#/components/schemas/extendedPartyDescription'
              mandateReference:
                description: |
                  Reference assigned by a creditor or ultimate creditor for internal usage for the mandate.
                allOf:
                  - $ref: '#/components/schemas/Max35Text'
              referredDocument:
                description: |
                  Provides information to identify the underlying documents associated with the mandate.
                allOf:
                  - $ref: '#/components/schemas/referredMandateDocumentInformation'
              mandateStatus:
                description: |
                  The status of the mandate resource.
                allOf:
                  - $ref: '#/components/schemas/MandateStatus'
              lastActionDate:
                description: |
                  This date is containing the date of the last action on the mandate object either through the openFinance API or the PSU/ASPSP interface having an impact on the status.
                allOf:
                  - $ref: '#/components/schemas/ISODate'
    decline_408_Mandates:
      headers:
        # X-Reference-API-Name:
        #   $ref: '#/components/headers/X-Reference-API-Name'
        # X-Reference-API-Document:
        #   $ref: '#/components/headers/X-Reference-API-Document'
        # X-Reference-API-Version:
        #   $ref: '#/components/headers/X-Reference-API-Version'
        Location:
          $ref: '#/components/headers/Location'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        ASPSP-Notification-Support :
          $ref: '#/components/headers/ASPSP-Notification-Support'
      description: Request Timeout
  examples: {}

